import mallApi from "@/api/declaration/mall/mallApi"
import httpRequest from "@/config/axios/httpRequest"
import { CategoryModel } from "@/models/mall/CategoryModel"


// 创建商品分类
export const createCategory = (data: CategoryModel) => {
  return httpRequest.post(mallApi.CreateCategory, data)
}

// 更新商品分类
export const updateCategory = (data: CategoryModel) => {
  return httpRequest.put(mallApi.UpdateCategory, data)
}

// 删除商品分类
export const deleteCategory = (id: number) => {
  return httpRequest.delete(mallApi.DeleteCategory, { params: { id } })
}

// 获得商品分类
export const getCategory = (id: number) => {
  return httpRequest.get(mallApi.GetCategory, { params: { id } })
}

// 获得商品分类列表
export const getCategoryList = (params: any) => {
  return httpRequest.get(mallApi.GetCategoryList, { params })
}
